﻿using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class CardDisplayerMonobehaviour : MonoBehaviour
{
    [Header("卡牌参数")]
    public CardPair pairData;

    [Header("卡牌UI组件")]
    [SerializeField] private TextMeshProUGUI titleText = null;
    [SerializeField] private TextMeshProUGUI costText = null;
    [SerializeField] private TextMeshProUGUI descriptionText = null;
    [SerializeField] private Image artImage = null;

    public void SetPairData(CardPair pairData)
    {
        this.pairData = pairData;

        FlushCardDisplay();
    }

    public void FlushCardDisplay()
    {
        if (this.pairData != null)
        {
            titleText.text = pairData.cardData.title;
            costText.text = pairData.cardData.cost.ToString();
            descriptionText.text = string.Format(pairData.cardData.description, pairData.cardData.value);
            artImage.sprite = pairData.cardData.image;
        }
    }
}
